package com.sundayfactory.workpaychart;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class adapter_paylist extends ArrayAdapter<domain_Paylist> {
    private View setView;
    LayoutInflater LI ;
    public adapter_paylist(Context context, int textViewResourceId,List<domain_Paylist> objects) {
	super(context, textViewResourceId, objects);
	 LI = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	setView = LI.inflate(textViewResourceId, null);
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
	View setView = convertView;
	viewHolder holder = null;
	if(setView == null){
	    setView = LI.inflate(R.layout.item_pay, null);
	    holder = new viewHolder();
	    holder.year = (TextView)setView.findViewById(R.id.textView3);
	    holder.title = (TextView)setView.findViewById(R.id.textView1);
	    holder.pay = (TextView)setView.findViewById(R.id.textView2);
	    
	    setView.setTag(holder);
	    
	}else{
	    holder = (viewHolder)setView.getTag();
	}
	domain_Paylist info = getItem(position);
	
	holder.year.setText(info.getYear());
	holder.title.setText(info.getTitle());
	holder.pay.setText(info.getPayString());
	
	
	
	return setView;
	
    }
    class viewHolder{
	TextView year;
	TextView title;
	TextView pay;
    }
    
}
